home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacHaskell 2.2 / com / lispworks / savesys-xlib < prev    next >
Encoding:
Text File  |  1994-09-27  |  2.4 KB  |  75 lines  |  [TEXT/ttxt]

  1. #!/bin/csh
  2. #
  3. # savesys -- build a saved executable in bin/new-lispworks-haskell
  4. #
  5. #
  6. cd $Y2
  7. setenv PRELUDEBIN $Y2/progs/prelude/lispworks
  8. if !(-e $PRELUDEBIN/Prelude.wfasl) then
  9.   echo "Build the prelude first, stupid..."
  10.   exit
  11.   endif
  12. setenv LIBRARYBIN $Y2/progs/lib/X11/lispworks
  13. if !(-e $LIBRARYBIN/xlib.wfasl) then
  14.   echo "Build the xlib stuff first, silly..."
  15.   exit
  16.   endif
  17. $LISPWORKS <<EOF
  18. ;;; Load the Haskell system.
  19. (load "com/lispworks/patches/safe-fo-closure.wfasl")
  20. (make-package "MUMBLE-IMPLEMENTATION" :use '("LISP"))
  21. (load "cl-support/cl-init")
  22. ;;; Set various internal switches to appropriate values for running
  23. ;;; Haskell code.
  24. (proclaim '(optimize (speed 3) (safety 0) (compilation-speed 0)))
  25. (setf *load-verbose* nil)
  26. (setf *compile-verbose* nil)
  27. (in-package :mumble-user)
  28. (setf *printers* '(compiling loading prompt))
  29. (setf *compile-interface* '#f)
  30. ;;; Load the prelude.
  31. (compile/load *prelude-unit-filename*)
  32. ;;; Load the X support.
  33. (compile/load "\$HASKELL_LIBRARY/X11/xlib")
  34. (setf *haskell-compiler-update* 
  35.     (string-append *haskell-compiler-update* "-X11"))
  36. ;;; Set up the saved system.
  37. (setf *modules-loaded* '())
  38. (define (haskell-toplevel)
  39.   ;; Need to reset pathname defaults
  40.   (setf lisp:*default-pathname-defaults* (lisp:truename ""))
  41.   (use-vanilla-interface)
  42.   (load-init-files)
  43.   (let ((args  (cdr sys::*line-argument-list*)))
  44.     (if (null? args)
  45.         (do () ('#f)
  46.           (lisp:with-simple-restart (restart-haskell "Restart Haskell.")
  47.             (heval)))
  48.         (lisp:with-simple-restart (restart-haskell "Exit Haskell.")
  49.           (hrun (car args) (cdr args))))))
  50. (define (restart-haskell)
  51.   (lisp:invoke-restart 'restart-haskell))
  52. (define (haskell-debugger-hook c f)
  53.   (declare (ignore f))
  54.   (if *haskell-debug-in-lisp*
  55.       (begin
  56.         (when *haskell-enter-debugger-hook*
  57.           (funcall *haskell-enter-debugger-hook*))
  58.         (lisp:unwind-protect (lisp:invoke-debugger c)
  59.           (when *haskell-exit-debugger-hook*
  60.             (funcall *haskell-exit-debugger-hook*))))
  61.       (begin
  62.         (format '#t "Lisp error:~%~a~%" c)
  63.         (haskell-backtrace)
  64.         (when *haskell-compilation-error-hook*
  65.           (funcall *haskell-compilation-error-hook*))
  66.         (format '#t "Restarting Haskell...~%")
  67.         (restart-haskell))))
  68. (setf lisp:*debugger-hook* (function haskell-debugger-hook))
  69. (lw:save-image "bin/new-lispworks-clx-haskell"
  70.   :gc '#t
  71.   :normal-gc '#f  ; don't reset gc parameters
  72.   :restart-function 'haskell-toplevel)
  73. (lw:bye)
  74. EOF
  75.